var quickSort = function( arr ) {
    if(arr.length<1) return arr;//退出递归的条件
    let pivotIndex = Math.floor(arr.length/2);
    let pivot = arr.splice(pivotIndex, 1);//取出数组中中间位置的值pivot
    let left = []
    let right = []
    arr.forEach(element => {
        if(element<pivot){
            left.push(element);
        }else{
            right.push(element);
        }
    });
    return quickSort(left).concat(pivot, quickSort(right));//合并

}
var dataArray = [85,24,63,45,17,31,96,50,22,55,765,234,678,23];
let startTime = new Date().getTime();
console.log(quickSort(dataArray).toString()); 
let endTime = new Date().getTime();
console.log(endTime,'-',startTime,'=',endTime-startTime);